<?php
	class url {
	
		var $path;
		var $segments = array();
	
		function __construct()
		{
			$this->getQuery();
		}
		private function getQuery()
		{
			if (isset($_GET) && count($_GET) == 1)
			{
				$this->path = trim(trim(key($_GET)),"/");
			}
			else
			{
				$this->path = trim(trim($_SERVER['PATH_INFO']),"/");
			}
			if ( $this->path != "" )
			{
				$this->segments = explode("/", $this->path);
			}
			$i = 1;
			foreach ($this->segments as $segment)
			{
				$this->segments[$i++] = $segment;
			}
			unset($this->segments[0]);
		}
		function segment($num)
		{
			if ( isset($this->segments[$num]) )
			{
				return $this->segments[$num];
			}
			else
			{
				return false;
			}
		}
		function __toString()
		{
			return "url";
		}
	}
?>